import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/demo_localizations.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:github_client_app/db/sqlite.dart';
import 'package:github_client_app/page/index_page.dart';
import 'package:github_client_app/provider/locale_provider.dart';
import 'package:github_client_app/provider/theme_provider.dart';
import 'package:github_client_app/router/routes.dart';
import 'package:github_client_app/services/http/dio_util.dart';
import 'package:github_client_app/services/tcp/tcp_util.dart';
import 'package:provider/provider.dart';
import 'package:bot_toast/bot_toast.dart';

main(List<String> args) async {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  MyApp({Key? key}) : super(key: key) {
    Routes.configureRoutes(); // 路由
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: "Flutter project",
      home: const MyHome(),
    );
  }
}

class MyHome extends StatelessWidget {
  const MyHome({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("ddddd")),
      body: OrientationBuilder(builder: (context, orientation) {
        print("屏幕旋转");
        return Center(
          child: Flex(
            direction: orientation == Orientation.landscape
                ? Axis.horizontal
                : Axis.vertical,
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: [
              for (int i = 0; i < 3; i++) FlutterLogo(size: 50),
            ],
          ),
        );
      }),
    );
  }
}
